function openWinAdd(){
	var diag = new top.Dialog();
	diag.Title = "新增商品信息";
	diag.URL = base + "admin/goods/add.action";
	diag.Height=650;
	diag.CancelEvent = function(){
		diag.innerFrame.contentWindow.location.reload();
		diag.close();
	};
	document.cookie="showGoods=1";
	diag.show();
}
function openWinFind(goodsId){
	var diag = new top.Dialog();
	diag.Title = "修改商品信息";
	diag.URL = base + "admin/goods/findByGoodsId.action?goodsInfo.id=" + goodsId;
	diag.Height=500;
	diag.CancelEvent = function(){
		diag.innerFrame.contentWindow.location.reload();
		diag.close();
	};
	document.cookie="showGoods=1";
	diag.show();
}
function openWinShow(goodsId){
	var diag = new top.Dialog();
	diag.Title = "查看商品信息";
	diag.URL = base + "admin/goods/showGoodsInfo.action?goodsInfo.id=" + goodsId;
	diag.Width=300;
	diag.Height=450;
	diag.CancelEvent = function(){
		diag.innerFrame.contentWindow.location.reload();
		diag.close();
	};
	diag.show();
}
function select(goodsId) {
	$.post(base + "admin/goods/findGoodsById.action", {"goodsInfo.id": goodsId}, function(data) {
		data = eval("(" + data + ")");
		var topDoc = top.document.getElementById("frmright").contentWindow.document;
		var orderNo = document.getElementById("orderNo").value;
		var $this = $(topDoc).find(".formdata tr:eq(" + orderNo + ")");
		$(topDoc).find(".merchantId").val(data.merchantId);
		$this.children("td:eq(1)").children("input:first-child").val(data.goodsNo);
		$this.children("td:eq(2)").children("input:first-child").val(data.goodsName);
		$this.children("td:eq(2)").children("div").html(data.goodsName);
		$this.children("td:eq(3)").children("input:first-child").val(data.id);
		$this.children("td:eq(3)").children("div").html(data.specification);
		$this.children("td:eq(4)").children("div").html(data.unitType);
		$this.children("td:eq(5)").children("input:first-child").val(1);
		$this.children("td:eq(6)").children("input:first-child").val(data.unitPrice);
		$this.children("td:eq(7)").children("input:first-child").val("1.0");
		$this.children("td:eq(8)").children("div").html(data.unitPrice);
		$this.children("td:eq(9)").children("input:first-child").val(data.creditNum);
		$this.children("td:eq(10)").children("div").html(data.recentPrice);
		$this.children("td:eq(11)").children("input:first-child").val(data.stock);
		$this.children("td:eq(11)").children("div").html(data.stock);
		$this.children("td:eq(12)").children("div").html(data.merchant.merchantName);
		$this.children("td:eq(1)").children(".order-no-search").hide();
		$(topDoc).find("input[type='submit']").attr("disabled", false);
		top.document.getElementById("frmright").contentWindow.payMent();
		top.document.getElementById("frmright").contentWindow.newRow();
		top.Dialog.close();
	});
}
